import os
import platform

SYS_TYPE = platform.system()


################################################
# 通用配置 #
################################################
# 根目录
DIR_PROGRAM_BASE = os.path.abspath(os.path.join(os.path.split(os.path.realpath(__file__))[0], '..'))

# 其他目录
DIR_TMP = os.path.join(DIR_PROGRAM_BASE, 'tmp')
DIR_MODEL = os.path.join(DIR_PROGRAM_BASE, 'model')
DIR_OUTPUT = os.path.join(DIR_PROGRAM_BASE, 'output')
DIR_CONFIG = os.path.join(DIR_PROGRAM_BASE, 'cfg')

# LINUX默认路径
DIR_DATA_BASE = '/'

################################################
# 自定义配置 #
################################################
# 定义原始数据路径
if SYS_TYPE == 'Windows':
    DIR_DATA_BASE = 'Z:\\data\\2023\\AMWD-webshell\\532068'

FILE_CONFIG_JSON = os.path.join(DIR_CONFIG, 'config.json')

DIR_TRAIN_DATA = os.path.join(DIR_DATA_BASE, "tctrain")
DIR_TEST_DATA = os.path.join(DIR_DATA_BASE, "tcdata")

DIR_TRAIN_AST = os.path.join(DIR_TRAIN_DATA, "train")
DIR_TEST_AST = os.path.join(DIR_TEST_DATA, "test")
FILE_TRAIN_CSV_DATA = os.path.join(DIR_TRAIN_DATA, "train.csv")
FILE_TEST_CSV_DATA = os.path.join(DIR_TEST_DATA, "test.csv")

# 中间数据
DIR_TMP_VOCAB = os.path.join(DIR_TMP, "vocab")
FILE_WORD_TYPES = os.path.join(DIR_TMP_VOCAB, "{type}", "word2id.node_types.pkl")
FILE_WORD_VALUES = os.path.join(DIR_TMP_VOCAB, "{type}", "word2id.node_values.pkl")
FILE_BEST_MODEL_MODEL = os.path.join(DIR_MODEL, 'best_{type}_validation.pth')

DIR_TMP_TRAIN_DATASET = os.path.join(DIR_TMP, "train_dataset")
DIR_TMP_VALID_DATASET = os.path.join(DIR_TMP, "val_dataset")
DIR_TMP_TEST_DATASET = os.path.join(DIR_TMP, "test_dataset")

FILE_OUTPUT_CSV = os.path.join(DIR_OUTPUT, 'result.csv')